﻿<!-- #include file="cjf.asp" -->
<!--#include file="conn.asp"-->
<!--#include file="inc/CHAR.INC"-->
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="images/style.css" type="text/css" rel="stylesheet">
    <script language="JavaScript" src="inc/js.js" type="text/javascript"></script>
</head>
<body>
    <center>
        <table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC"
            style="margin-top: 5px">
            <tr bgcolor="3972B4">
                <td width="100%" colspan="3" bgcolor="e7e7e7">
                    <%set rs=server.CreateObject("ADODB.RecordSet")
if request("itemid")<>"" then
startid=request("startid")
	sql="select * from cjitem where id="&request("itemid")
rs.open sql,conn,1,3
itemlist=rs("item")
endid=rs("endid")
if int(startid) > int(endid) then
   Response.write "本项目采集完成，共采集到"&endid+1&"个章节,<a href=cjzjitem_manage.asp>返回</a>"
   Response.End
end if
if request("page")="" then
rs("startid")=rs("startid")+1
end if
rs.update
rs.close
itemlist1=Split(itemlist,"|")
s=ubound(itemlist1)
itemlist2=itemlist1(startid)
itemlist3=Split(itemlist2,",")
sql="select * from zjlog where id="&itemlist3(1)
else
id=request("id")
sql="select * from zjlog where id="&id
end if
rs.open sql,conn,1,3
cjzj_id=rs("id")
zjmc=trim(rs("zjmc"))
cjwebid=rs("cjwebid")
cjzjid=rs("cjzjid")
cjcid=rs("cjcid")
cjcomicid=rs("cjcomicid")
comicid=rs("comicid")
rs.close
if zjmc="" then
zjmc="全集"
end if
sql="select * from cjxm where id="&cjwebid
rs.open sql,conn,1,3
xmmc=rs("xmmc")
xmfd=rs("xmfd")
picxz=rs("picxz")
xmsx=rs("xmsx")
fnbody=rs("fnbody")
fnfg=rs("fnfg")
fnid=rs("fnid")
fnmc=rs("fnmc")
mhurl=rs("mhurl")
mhbody=rs("mhbody")
mhmc=rs("mhmc")
mhtp=rs("mhtp")
mhtpurl=rs("mhtpurl")
mhzz=rs("mhzz")
mhjs=rs("mhjs")
mhzt=rs("mhzt")
mhfg=rs("mhfg")
mhzj=rs("mhzj")
mhzjid=rs("mhzjid")
zjurl=rs("zjurl")
zjbody=rs("zjbody")
zjsx=rs("zjsx")
zjfy=rs("zjfy")
zjtpurlsx=rs("zjtpurlsx")
zjtpsl=rs("zjtpsl")
zjtpsurl=rs("zjtpsurl")
zjtpurl=rs("zjtpurl")
rs.close%>
                    <%
if request("page")<>"" then
page=request("page")
else
page=1
end if

   pageid=page
   zjurl=Replace(zjurl,"[ID1]",""&cjcid&"") 
   zjurl=Replace(zjurl,"[ID2]",""&cjzjid&"") 
   zjurl=Replace(zjurl,"[ID3]",""&pageid&"")
   if picxz=true then
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if fso.folderexists(server.mappath("../comicdata/"&comicid&"\"&foldername))=false then
Fso.Createfolder(server.mappath("../comicdata/"&comicid&"\"&foldername))
end if
if fso.folderexists(server.mappath("../comicdata/"&comicid&"/"&zjmc&"\"&foldername))=false then
Fso.Createfolder(server.mappath("../comicdata/"&comicid&"/"&zjmc&"\"&foldername))
end if
savepath="../comicdata/"&comicid&"/"&zjmc&"/"&pageid&".jpg"
end if
nextpage=page+1
url=zjurl
if url="" then
   Response.write "&nbsp;请输入漫画页地址&nbsp;&nbsp;<A HREF=# onclick=""Javascript:history.back(-1)""><FONT  COLOR=#FF0000>请点这里返回</FONT></A>"
   Response.End
end if
   MusicMake
Sub MusicMake

MakeIMG
End Sub

Sub MakeIMG
Dim k:k=0




url=bqtf1(url)
zjbody=bqtf1(zjbody)
zjtpsl=bqtf1(zjtpsl)
zjtpurl1=bqtf1(zjtpurl1)

zjbody1=Split(zjbody,"$")
zjtpsl1=Split(zjtpsl,"$")
zjtpurl1=Split(zjtpurl,"$")

zlp=GetHttp(url) 

'采集相关信息开始
body=GetStr(zlp,zjbody1(0),zjbody1(1))
zjtpsl2=GetStr(body,zjtpsl1(0),zjtpsl1(1))
zjtpurl2=GetStr(body,zjtpurl1(0),zjtpurl1(1))
zjtpurl2=Replace(zjtpurl2,"'","") 
zjtpurl3=zjtpsurl&zjtpurl2
'开始写入数据
'===================================================
'RString=DeHttpdata(zlp,"'[^<>'']*','[^<>'']*','[^<>""]*'")
if xmfd=true then
getPICurl=""&web_url&"/inc/picpj.asp?url="&zjtpurl3
else
getPICurl=""&zjtpurl3&""
end if
Response.write "<table border=0 width=100% align=center>"
Response.write  "<tr><td width=100% colspan=""5"">"
Response.write  "本章节:&nbsp;"&zjmc&"&nbsp;共有&nbsp;"&trim(zjtpsl2)&"&nbsp;张图片&nbsp;&nbsp;目前:"&pageid&"</td></tr>"
Sql="Select * From zj where cjitemid='"&trim(cjzj_id)&"'"
Rs.Open Sql,Conn,1,3
if rs.eof then
Rs.AddNew
rs("cid")=comicid
rs("zjmc")=zjmc
rs("tpadd")=comicid&"/"&zjmc&"/"
rs("tps")=trim(zjtpsl2)
rs("tpf")=0
rs("adddate")=now()
rs("tpurl")=zjtpurl2&"|"
rs("hits")=0
rs("cjitemid")=cjzj_id
rs.update
Response.write " 数据保存成功"
else
if instr(""&rs("tpurl")&"",""&zjtpurl2&"")<>0  then
Response.write "图片地址已存在"
else
rs("tpurl")=rs("tpurl")&zjtpurl2&"|"
rs.update
Response.write "图片地址更新成功"
end if
end if

rs.close


Response.write  "<tr><td width=100% colspan=""5"">"
if picxz=true then
if fso.FileExists(server.mappath(savepath))=false then
Response.write "下载图片："&zjtpurl3&" 保存为："&savepath&""
call saveimg(getPICurl,savepath)
else
Response.write "下载图片："&zjtpurl3&" 保存为："&savepath&" &nbsp;<font color=blue>图片存在，已跳过</font>"
end if
else
Response.write "<font color=blue>漫画图片没有下载</font>"
end if

if pageid=zjtpsl2 then
Response.write "&nbsp;<font color=red>本章节采集完成</font>"
if request("itemid")<>"" then
Response.write "&nbsp;<font color=red>继续下一章</font>"
Response.write "<meta http-equiv=""refresh"" content=""0;url='cj_comic_zj.asp?itemid="&request("itemid")&"&startid="&request("startid")+1&""">"
end if
else
MakeNexttp
end if
Response.write "</td></tr>"
response.flush

Response.write "</table>"

End Sub
Sub MakeNexttp
Response.write "<meta http-equiv=""refresh"" content=""0;url='cj_comic_zj.asp?itemid="&request("itemid")&"&startid="&request("startid")&"&id="&id&"&page="&nextpage&""">"
end sub
                    %>
                </td>
            </tr>
        </table>
    </center>
</body>
</html>
